#!/bin/bash
err() { echo Error. $@ not found.; exit 1; }
[ -z `which sam-ba` ] && err sam-ba
[ ! -c /dev/ttyUSB1 ] && err /dev/ttyUSB1
[ ! -d /opt/9263/deploy ] && err /opt/9263/deploy
cp dataflash.tcl /opt/9263/deploy
cd /opt/9263/deploy
[ ! -f dataflash.tcl ] && err dataflash.tcl
[ ! -f bootstrap.bin ] && err bootstrap.bin
[ ! -f u-boot.bin ] && err u-boot.bin
[ ! -f kernel.bin ] && err kernel.bin
sam-ba /dev/ttyUSB1 AT91SAM9263-EK dataflash.tcl
rm dataflash.tcl u-boot.env -f
